package com.zyc.socket;

import com.zyc.annotation.RpcScan;
import com.zyc.remoting.transport.socket.SocketRpcServer;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author zyc
 * @create 2022--05--30 21:50
 */
@RpcScan(basePackage = {"com.zyc"})
public class ServerSpringAnnotation {
    public static void main(String[] args) {
        //通过注解注册扫描包自动注册服务，将bean交由spring容器管理
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(ServerSpringAnnotation.class);
        String[] beanDefinitionNames = applicationContext.getBeanDefinitionNames();
        SocketRpcServer socketRpcServer = (SocketRpcServer) applicationContext.getBean("socketRpcServer");
        socketRpcServer.start();
    }
}
